let a: number | boolean = 123; // ts 中的冒号 是对前边的那个变量的一个类型声明
let b: boolean;
// b = true
let c: string;

let ary: number[] = [123];

function add(q: number, w: number): number {
  return q + w
}
add(1, 1)
let ary2 = [{ age: 12, name: 345 }]
// ts中的接口 是一个对 对象的限制说明
interface Iqqq {
  readonly age: number,
  name: string,
  // qqq?: number,
  // www?:any
  [prop: string]: any
}
interface Ittt extends Iqqq {
  sex: number
}

let obj: Iqqq = {
  age: 123,
  name: '234'
}
obj.name = '666'
// obj.age = 888
let ary3: Iqqq[] = [{ age: 1, name: '' }]











ary3.push({
  name: '',
  age: 123,
  qqq: 234,
  www: true,
  t: 5,
  y: ''
})
ary3[0].name

let obj2: Ittt = {
  age: 555,
  name: '',
  sex: 6
}

// let ttt:any[] = []
// let tttt:Array<any> = []
function createArray<T>(length: number, value: T): Array<T> {
  let res: T[] = [];
  for (let i = 0; i < length; i++) {
    res[i] = value
  }
  // res.push(true)
  return res
}
createArray<string>(4, 'qq')
createArray<number>(4, 88)

export { }
